Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.9.6 #250

Merged
merged 9 commits into from
Jan 24, 2022
Merged

Release v0.9.6 #250

merged 9 commits into from
Jan 24, 2022

Conversation

prkumar
Copy link
Owner

@prkumar prkumar commented Jan 24, 2022

Added

  • Add a new base class, uplink.retry.RetryBackoff, which can be extended to
    implement custom backoff strategies. An instance of a RetryBackoff subclass
    can be provided through the backoff argument of the @retry decorator.
    (@retry should respect 429 Retry-After headers #238)

Changed

Fixed

prkumar and others added 9 commits January 4, 2022 01:21
Merge stable into master
Adds a new base class, `uplink.retry.RetryBackoff`, which can be extended to implement custom backoff strategies. Subclasses can override three methods:

- `get_timeout_after_response(request, response)`: Returns the number of seconds to wait before retrying the request, or ``None`` to indicate that the given response should be returned.
- `get_timeout_after_exception(request, exc_type, exc_val, exc_tb)`: Returns the number of seconds to wait before retrying the request, or ``None`` to indicate that the given exception should be raised.
- `handle_after_final_retry()`: Handles any clean-up necessary following the final retry attempt.

An instance of a `RetryBackoff` subclass can be provided through the `backoff` argument of the `@retry` decorator.

#238
…229)

Fix ``@returns.json`` to cast JSON response (or field referenced by the ``key`` argument) using the ``type`` argument when the given type is callable. This restores behavior that was inadvertently changed in v0.9.3.

Example:

```python
  @uplink.returns.from_json(key=("data", 0, "size"), type=int)
  @uplink.get("/users/{user}/repos")
  def get_first_repo_size(self, user):
      pass
```

```python
assert github.get_first_repo_size("prkumar") == 300
```

#215
@codecov
Copy link

codecov bot commented Jan 24, 2022

Codecov Report

Merging #250 (55989ac) into stable (a013758) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            stable      #250   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           44        44           
  Lines         2410      2464   +54     
  Branches       342       358   +16     
=========================================
+ Hits          2410      2464   +54     
Impacted Files Coverage Δ
uplink/clients/aiohttp_.py 100.00% <100.00%> (ø)
uplink/clients/io/asyncio_strategy.py 100.00% <100.00%> (ø)
uplink/retry/__init__.py 100.00% <100.00%> (ø)
uplink/retry/backoff.py 100.00% <100.00%> (ø)
uplink/retry/retry.py 100.00% <100.00%> (ø)
uplink/returns.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a013758...55989ac. Read the comment docs.

@prkumar prkumar merged commit 8a369e9 into stable Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants